package array;

public class SortMaopao2 {
	public static void main(String[] args) {
		int[]a={12,24,15,25,36,64,243,324,23,42,22,61};
		p(a);
		sort(a);
		p(a);
	}

	private static void sort(int[] a) {
		for (int i = 0; i < a.length-1; i++) {
			for (int j = i+1; j < a.length; j++) {
				if(a[i]>a[j]){
					int temp=a[i];
					a[i]=a[j];
					a[j]=temp;
				}
			}
		}
	}

	private static void p(int[] a) {

		for (int i = 0; i < a.length; i++) {
			System.out.printf("%-4d",a[i]);
		}
		System.out.println();
	}

}
